import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../bridge/bridge.dart';
import '../../router/app_route_container.dart';
import 'mine_logic.dart';

class MinePage extends StatelessWidget {
  MinePage({Key? key}) : super(key: key);

  final logic = Get.find<MineLogic>();
  final state = Get.find<MineLogic>().state;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("MinePage"),
      ),
      body: Column(
        children: [
          const SizedBox(height: 20),
          GestureDetector(
            onTap: () {
              FlutterBridge.getInstance().flutterToAndroid({'event': "toNativeAct"});
            },
            child: const Text(
              "点击跳转到Android原生Setting页面",
              style: TextStyle(fontSize: 16),
            ),
          ),
          const SizedBox(height: 20),
          Obx(() => Text(
                state.message.value,
                style: const TextStyle(fontSize: 16),
              )),
          const SizedBox(height: 20),
          GestureDetector(
            onTap: () {
              AppRouteContainer.share.openPage(context, "/setting");
            },
            child: const Text(
              "点击跳转到Flutter原生Setting页面",
              style: TextStyle(fontSize: 16),
            ),
          ),
          const SizedBox(height: 20),
        ],
      ),
    );
  }
}
